/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.coopeud.persistencia;

import java.sql.Connection;
import java.sql.DriverManager;

public class ConexionOracle {

    private Connection conexion;


    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
          ConexionOracle obconeccion=new ConexionOracle();
    obconeccion.Conectar();
    }
    
    public Connection getConexion() {
        return conexion;
    }

        public void setConexion(Connection conexion) {
        this.conexion = conexion;
    }
    
    public ConexionOracle Conectar()
    {
        try{
        Class.forName("oracle.jdbc.OracleDriver");
        String BaseDeDatos = "jdbc:oracle:thin:@localhost:1521:XE";
        conexion= DriverManager.getConnection(BaseDeDatos,"DBPRUEBA","123");
        if(conexion!=null)
        {
        System.out.println("Conexion exitosa a esquema BDDEMO1");
        }
        else{System.out.println("Conexion fallida");}
        }
        catch(Exception e)
            {System.out.println("No se conecto"); }
            
       // {e.printStackTrace();}
       
            
            
    return this;
    

        
    }
    
}

